<script lang="ts" setup>
import TaskOrderTable from './components/task-order-table.vue'
import TaskOrderQuery from './components/task-order-query.vue'
import { useTableHelper } from '@/components/base/table/table-helper'
import { api } from '@/utils/api-instance'
import { provide } from 'vue'
import type { TaskOrderSpec } from '@/apis/__generated/model/static'
import { useQueryHelper } from '@/components/base/query/query-helper'

const initQuery: TaskOrderSpec = {}
const tableHelper = useTableHelper(
  api.taskOrderForAdminController.query,
  api.taskOrderForAdminController,
  initQuery,
)
const { query, restQuery } = useQueryHelper<TaskOrderSpec>(initQuery)
provide('taskOrderTableHelper', tableHelper)
</script>
<template>
  <div class="task-order-view">
    <task-order-query
      v-model:query="query"
      @reset="restQuery"
      @search="tableHelper.reloadTableData({ query })"
    ></task-order-query>
    <task-order-table></task-order-table>
  </div>
</template>

<style lang="scss" scoped>
.task-order-view {
  background: white;
  padding: 20px;
  border-radius: 5px;
}
</style>
